<!DOCTYPE html>
<!--
Copyright (c) 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/tracing/base/math/bbox2.html">
<link rel="import" href="/tracing/base/math/quad.html">
<link rel="import" href="/tracing/base/math/rect.html">
<link rel="import" href="/tracing/ui/base/quad_stack_view.html">
<script>
'use strict';

// See https://crbug.com/1111537
tr.b.unittest.skippedTestSuite(function() {
  function createQuads() {
    const quads = [
      tr.b.math.Quad.fromXYWH(-500, -500, 30, 30), // 4 corners
      tr.b.math.Quad.fromXYWH(-500, 470, 30, 30),
      tr.b.math.Quad.fromXYWH(470, -500, 30, 30),
      tr.b.math.Quad.fromXYWH(470, 470, 30, 30),
      tr.b.math.Quad.fromXYWH(-250, -250, 250, 250), // crosshairs
      tr.b.math.Quad.fromXYWH(0, -250, 250, 250), // crosshairs
      tr.b.math.Quad.fromXYWH(-250, 0, 250, 250), // crosshairs
      tr.b.math.Quad.fromXYWH(0, 0, 250, 250) // crosshairs
    ];
    quads[0].stackingGroupId = 0;
    quads[1].stackingGroupId = 0;
    quads[2].stackingGroupId = 0;
    quads[3].stackingGroupId = 0;
    quads[4].stackingGroupId = 1;
    quads[5].stackingGroupId = 1;
    quads[6].stackingGroupId = 1;
    quads[7].stackingGroupId = 1;
    return quads;
  }

  function createQuadStackView(testFramework) {
    const quads = createQuads();
    const view = new tr.ui.b.QuadStackView();
    // simulate the constraints of the layer-tree-view
    view.style.height = '400px';
    view.style.width = '800px';
    view.deviceRect = tr.b.math.Rect.fromXYWH(-250, -250, 500, 500);
    view.quads = quads;

    testFramework.addHTMLOutput(view);
    return view;
  }

  test('initialState', function() {
    const view = createQuadStackView(this);

    const viewRect =
        view.getBoundingClientRect();
    assert.strictEqual(viewRect.height, 400);
    assert.strictEqual(viewRect.width, 800);
  });
});
</script>
